import { getBannerList, getBannerTotal } from '../../utils/api'
export default {
    namespaced: true,
    state: {
        bannerList: [],
        bannerTotal: 0
    },
    mutations: {
        bannerListInit(state, payload) {
            state.bannerList = payload
        },
        bannerTotalInit(state, payload) {
            state.bannerTotal = payload
        }
    },
    actions: {
        // payload={page,size}
        async getBannerListAction({ commit }, payload) {
            const { data } = await getBannerList(payload)
            if (data.code === 200) {
                commit('bannerListInit', data.data)
            }
        },
        async getBannerTotalAction({ commit }, payload) {
            const { data } = await getBannerTotal(payload)
            if (data.code === 200) {
                commit('bannerTotalInit', data.data)
            }
        }
    }
}